import React, { Component } from 'react';

class MessageInput extends Component {
    handleClick = () => {
        this.props.addMessage(this.message.value)
        this.message.value = '';
    }
    render() { 
        return ( <div className = "form-group">
            <input type = 'text' className = 'form-control' ref = {dom => this.message = dom}/>
            <br/>
            <button onClick = {this.handleClick}>留言</button>
        </div> );
    }
}
 
export default MessageInput;